package com.smarttourism.service.impl;

import com.smarttourism.domain.Goods;
import com.smarttourism.mapper.GoodsMapper;
import com.smarttourism.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author：王祖威
 * @Date ：2024/10/23 11:33
 */
@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;


    @Override
    public int add(Goods goods) {
        return goodsMapper.insert(goods);
    }

    @Override
    public int removeBatch(Integer[] ids) {
        return goodsMapper.delete(ids);
    }

    @Override
    public int updateById(Goods goods) {
        return goodsMapper.update(goods);
    }

    @Override
    public Goods findById(Integer id) {
        return goodsMapper.selectById(id);
    }

    @Override
    public List<Goods> findAll(String gName, String typeName) {
        return goodsMapper.selectAll(gName,typeName);
    }
}
